<?php
/*
  Copyright (c) 2010-02 SongCMS
  SongCMS All Rights Reserved.
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
include_once('Admin.php');
if ($_POST['Action']=='UpDate'){

	$systemfile = '../config/system.php';
	$xPOST = $_POST;
	unset($xPOST['Submit'],$xPOST['Action']);

	$xPOST['WebDefaultHome'] = $_POST['DefaultHome'] == '0' ?  'Auto' : htmlspecialchars(stripcslashes($_POST['WebDefaultHome']),ENT_QUOTES);
	$xPOST['WebStaticHTML'] = is_numeric($_POST['WebStaticHTML']) ? $_POST['WebStaticHTML'] : 0;
	$xPOST['WebDelHTML'] = is_numeric($_POST['WebDelHTML']) ? $_POST['WebDelHTML'] : 0;
	$xPOST['WebHost'] = substr($_POST['WebHost'],-1,1) != '/' ? $_POST['WebHost'].'/' : $_POST['WebHost'];
	$xPOST['WebMaintenanceText'] = htmlspecialchars(stripcslashes($_POST['WebMaintenanceText']),ENT_QUOTES);
	$xPOST['WebCommentOpen'] = @implode(',',$xPOST['WebCommentOpen']);
	if(substr($xPOST['WebHost'],0,7) != 'http://') $xPOST['WebHost'] = 'http://'.$xPOST['WebHost'];
	if($ConfigWebDefaultHome == 0) $xPOST['DefaultHome'] = 'index.php';

	$xPOST['WebIP'] = $_SERVER['REMOTE_ADDR'];
	$xPOST['WebDate'] = date("Y-m-d H:i:s");
	$xPOST['WebAdminName'] = $_SESSION['UserName'];

	$phpdata = '<?php'."\r\n".'$SYSTEMCONFIG = '.var_export($xPOST,true)."\r\n?>";

	if(@file_put_contents($systemfile,$phpdata)){
		//conifg.js文件中记录是否开启简繁体互换
		$oVar['na'] = array('var CONFIG_TRADITIONAL');
		$oVar['va'] = array($_POST['isTraditional'] == "1" ? 1 : 0);
		if(($xxo = $admin->updatevar('../config/config.js',$oVar)) !== true) MsgBox (1,$xxo,'1');

		AdminLog(1,1,'修改"系统全局设定"，结果：操作成功！');
		if($_POST['WebManagementInterface'] == $SYSTEMCONFIG['WebManagementInterface']){ //是否修改了后台样式
			MsgBox (1,'系统全局设定修改成功！','1');
		} else {
			echo '<script type="text/javascript">parent.location.href="index.php?'.time().'";</script>';
			MsgBox (1,'系统全局设定修改成功！','1');
		}
	} else {
		AdminLog(1,1,"更新配置文件出错：{$systemfile}");
		MsgBox (1,"更新配置文件出错，请确认您是否有相应的写入权限：{$systemfile}","1");
	}
}
$WebCommentOpen = explode(',',$WebCommentOpen);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../js/csshovernotie6.js" type="text/javascript"></script>
<link href="./images/adminstyle.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="../favicon.ico">
<link rel="Bookmark" href="../favicon.ico">
<style type="text/css">
.sub{border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-right-color:#CCCCCC; border-bottom-color:#CCCCCC; border-left-color:#CCCCCC;}
.jg{border-bottom:1px #000 solid;}
</style>
<script language="javascript">
function Check(ID){ //默认首页
	if (ID==1) {
		document.all.WebDefaultHome.value='Auto';
		document.all.WebDefaultHome.disabled='disabled';
	} else if(ID==2) {
		<?php strtolower($WebDefaultHome) == 'auto' ? $Fcn='请输入指定的首页文件或路径' : $Fcn = $WebDefaultHome; ?>
		document.all.WebDefaultHome.value='<?php echo $Fcn?>';
		document.all.WebDefaultHome.disabled='';
	}
}
function CheckForm() {
	if (document.form1.WebHost.value.length < 12)	{
		alert("请输入正确的网站域名！")
		document.form1.WebHost.focus()
		return false
	}
<?php if ($ConfigWebDefaultHome == 1){?>
	if (escape(document.form1.WebDefaultHome.value).indexOf("%u")!=-1){
		alert("指定的首页文件名不正确！");
		document.form1.WebDefaultHome.focus();
		return false;
	}
<?php }?>
}
</script>
</head>
<body>
<br />
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="1">
	<tr><td align="right">
		<input type="button" value="网站基本设置" onClick="javascript:location.href='WebConfig.php?Lang=<?php echo $Lang?>'">
	</td></tr>
</table>
<form id="form1" name="form1" method="post" action="WebSystem.php" style="margin:0px; display:inline;" onSubmit="return CheckForm()">
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
  <tr class="odd">
    <td colspan="3" align="center" class="Main_Title">系统全局设定</td>
  </tr>
  <tr class="odd">
    <td width="18%" align="right">网站域名：    </td>
    <td width="36%"><input name="WebHost" type="text" class="input2" id="WebHost" value="<?php echo $WebHost?>" maxlength="100" />
      <span class="red">*</span></td>
    <td width="46%">格式：<font class="Igreen">http://www.songcms.com/</font></td>
  </tr>
<?php if($ConfigWebDefaultHome == 1){ ?>
  <tr class="odd">
    <td align="right">默认首页：</td>
    <td>
		<input name="DefaultHome" type="radio" value="0" <?php if (strtolower($WebDefaultHome)=='auto'){echo 'checked="checked"';}?> onClick="return Check(1)" />智能切换
        <input name="DefaultHome" type="radio" value="1" <?php if (strtolower($WebDefaultHome)!='auto'){echo 'checked="checked"';}?> onClick="return Check(2)" />指定首页
	</td>
    <td rowspan="2"><font class="Igreen">智能切换</font>：根据访问者IP区域及操作系统语言自动切换首页<br />
　　　　　国外及非中文操作系统的用户将自动切换到英文首页<br />
　　　　　中文操作系统的用户将自动切换到中文首页<br />
<font class="Igreen">指定首页</font>：将指定的文件作为默认首页,如：&quot;<font class="Igreen">FlashHome.html</font>&quot;</td>
  </tr>
  <tr class="odd">
    <td align="right">指定首页：</td>
    <td><input name="WebDefaultHome" type="text" class="input2" id="WebDefaultHome" <?php if (strtolower($WebDefaultHome)=='auto'){echo 'disabled';}?> value="<?php echo $WebDefaultHome?>" maxlength="50" /></td>
    </tr>
<?php } ?>
<tr class="odd">
    <td align="right">网站状态：</td>
    <td>
		<input name="WebOpening" type="radio" id="radio3" value="1" <?php if($WebOpening==1) {echo 'checked="checked"';}?> />开启
        <input type="radio" name="WebOpening" id="radio4" value="0" <?php if($WebOpening==0) {echo 'checked="checked"';}?> />关闭
	</td>
    <td>维护及数据备份期间可设置关闭网站</td>
  </tr>
<?php if($ConfigeWebHTML == 1){ ?>
 <tr class="odd">
    <td align="right">是否开启HTML静态化：</td>
    <td>
		<input name="WebStaticHTML" type="radio" id="radio3" value="1" <?php if($WebStaticHTML==1) {echo 'checked="checked"';}?> />开启
        <input name="WebStaticHTML" type="radio" id="radio4" value="0" <?php if($WebStaticHTML==0) {echo 'checked="checked"';}?> />关闭
	</td>
    <td>开启后可生成HTML静态站点</td>
  </tr>
 <tr class="odd">
    <td align="right">批量生成HTML间隔时间：</td>
    <td><input name="WebDelHTML" type="text" id="WebDelHTML" value="<?php echo $WebDelHTML?>" size="4" maxlength="2" /> 秒</td>
    <td>视服务器情况而定,建议设置为3秒</td>
  </tr>
<?php } ?>
  <tr class="odd">
    <td align="right">系统后台管理界面：</td>
    <td>
		<input name="WebManagementInterface" type="radio" value="0" <?php if($WebManagementInterface==0) {echo 'checked="checked"';}?> />默认模式
        <input name="WebManagementInterface" type="radio" value="1" <?php if($WebManagementInterface==1) {echo 'checked="checked"';}?> />经典界面
	</td>
    <td>更改后台界面风格</td>
  </tr>
  	<tr class="odd">
    <td align="right" class="jg">维护说明：</td>
    <td class="jg"><textarea name="WebMaintenanceText" id="WebMaintenanceText" cols="25" rows="4"><?php echo $WebMaintenanceText?></textarea></td>
    <td class="jg">在网站关闭状态下显示,支持Html语法</td>
  	</tr>
  <tr style="display:none;" class="odd">
    <td align="right">会员注册审核：</td>
    <td>
		<input name="WebUserAudit" type="radio" value="0" <?php if($WebUserAudit==0) {echo 'checked="checked"';}?> />人工审核
		<input name="WebUserAudit" type="radio" value="1" <?php if($WebUserAudit==1) {echo 'checked="checked"';}?> />无需审核
	  </td>
    <td>会员注册是否需要人工审核后方可登录</td>
  </tr>
<?php if($ConfigeGuestBook == 1){ ?>
  <tr class="odd">
    <td align="right">留言显示模式：</td>
    <td>
		<input name="WebGuestBook" type="radio" value="1" <?php if($WebGuestBook==1) {echo 'checked="checked"';}?> />审核后显示
		<input type="radio" name="WebGuestBook" value="0" <?php if($WebGuestBook==0) {echo 'checked="checked"';}?> />无需审核
	  </td>
    <td>前台提交留言是否需要管理员审核后显示</td>
  </tr>
<?php } ?>
  <tr style="display:none;" class="odd">
    <td align="right">评论功能开启：</td>
    <td>
		<input name="WebCommentOpen[]" type="checkbox" value="page" <?php if(in_array('page',$WebCommentOpen)) echo 'checked';?> />文章评论
		<input name="WebCommentOpen[]" type="checkbox" value="product" <?php if(in_array('product',$WebCommentOpen)) echo 'checked';?> />产品评论
		<input name="WebCommentOpen[]" type="checkbox" value="news" <?php if(in_array('news',$WebCommentOpen)) echo 'checked';?> />新闻评论
		<input name="WebCommentOpen[]" type="checkbox" value="survey" <?php if(in_array('survey',$WebCommentOpen)) echo 'checked';?> />调查评论
     </td>
    <td>是否开启相应模板的评论功能</td>
  </tr>
  <tr style="display:none;" class="odd">
    <td align="right">发表评论：</td>
    <td>
		<input name="WebCommentPublication" type="radio" value="1" <?php if($WebCommentPublication==1) {echo 'checked="checked"';}?> />会员登录发表
		<input name="WebCommentPublication" type="radio" value="0" <?php if($WebCommentPublication==0) {echo 'checked="checked"';}?> />匿名发表评论
	  </td>
    <td>发表评论是否需要会员登录</td>
  </tr>
  <tr style="display:none;" class="odd">
    <td class="jg" align="right">评论显示模式：</td>
    <td class="jg">
		<input name="WebCommentShow" type="radio" value="1" <?php if($WebCommentShow==1) {echo 'checked="checked"';}?> />审核后显示
		<input name="WebCommentShow" type="radio" value="0" <?php if($WebCommentShow==0) {echo 'checked="checked"';}?> />无需审核
	  </td>
    <td class="jg">前台提交评论是否需要管理员审核后显示</td>
  </tr>
<?php if($ConfigEmailServer == 1){ ?>
   <tr class="odd">
    <td width="18%" align="right">发件服务器(SMTP)：</td>
    <td width="36%"><input name="WebSMTP" type="text" class="input2" id="WebSMTP" value="<?php echo $WebSMTP?>" maxlength="50" /></td>
    <td width="46%">SMTP服务器地址，如：<font class="Igreen">smtp.163.com</font></td>
  </tr>
   <tr class="odd">
     <td align="right">发件邮箱地址：</td>
     <td><input name="WebMailAddress" type="text" class="input2" id="WebMailAddress" value="<?php echo $WebMailAddress?>" maxlength="50" /></td>
     <td>系统将自动登录该邮箱发送邮件</td>
   </tr>
   <tr class="odd">
     <td align="right">邮箱登录用户名：</td>
     <td><input name="WebMailName" type="text" class="input2" id="WebMailName" value="<?php echo $WebMailName?>" maxlength="30" /></td>
     <td>发件邮箱登录用户名</td>
   </tr>
   <tr class="odd">
     <td align="right" class="jg">邮箱登录密码：</td>
     <td class="jg"><input name="WebMailWord" type="password" class="input2" id="WebMailWord" value="<?php echo $WebMailWord?>" maxlength="32" /></td>
     <td class="jg">发件邮箱登录密码</td>
   </tr>
<?php }?>
  	<tr class="odd">
    <td align="right">模板静态缓存：</td>
    <td>
		<input name="WebStaticCache" type="radio" id="radio" value="1" <?php if($WebStaticCache==1){echo 'checked="checked"';}?> />开启
    	<input type="radio" name="WebStaticCache" id="radio2" value="0" <?php if($WebStaticCache==0){echo 'checked="checked"';}?> />关闭
	</td>
    <td>开启后将大幅提升访问速度</td>
  	</tr>

  	<tr class="odd">
    <td align="right">模板缓存时间：</td>
    <td><input name="WebCacheLifetime" type="text" id="WebCacheLifetime" value="<?php echo $WebCacheLifetime?>" size="5" maxlength="6" />秒</td>
    <td>-1缓存永不过期,其它数字为缓存时间</td>
  	</tr>

	<tr class="odd">
    <td align="right">自动清空缓存：</td>
    <td>
		<input name="WebClearAllCache" type="radio" id="radio7" value="1" <?php if($WebClearAllCache==1){echo 'checked="checked"';}?> />开启
		<input type="radio" name="WebClearAllCache" id="radio8" value="0" <?php if($WebClearAllCache==0){echo 'checked="checked"';}?> />关闭
	</td>
    <td>后台的每次操作系统都将自动清空所有缓存文件</td>
  	</tr>

	 <tr class="odd">
    <td align="right" class="jg">强制编译：</td>
    <td class="jg">
		<input name="WebForceCompil" type="radio" id="radio9" value="1" <?php if($WebForceCompil==1){echo 'checked="checked"';}?> />是
		<input type="radio" name="WebForceCompil" id="radio10" value="0" <?php if($WebForceCompil==0){echo 'checked="checked"';}?> />否
	</td>
    <td class="jg">强制Smarty每次调用时都重新编译模板文件，非必要时请勿开启</td>
  	</tr>

	 <tr class="odd">
    <td align="right">开通几种语言版本：</td>
    <td>
		<select name="WebLangKind" id="WebLangKind">
		<?php
		for($i=1;$i<=20;$i++){
			if($WebLangKind != $i){
    			echo "<option value=\"{$i}\">{$i}</option>";
			}else{
    			echo "<option value=\"{$i}\" selected=\"selected\">{$i}</option>";
			}
		}
		?>
    	</select>
	</td>
    <td>增加新的语言请修改语言包</td>
  	</tr>

	 <tr class="odd">
    <td align="right">每一种语言名称：</td>
    <td><input name="WebLangName" type="text" id="WebLangName" maxlength="120" class="input2" value="<?php echo implode(',',$WebLangName) ?>" /></td>
    <td>多语言用英文逗号","隔开</td>
  	</tr>

	 <tr class="odd">
	 	<td align="right">网站默认语言：</td>
	 	<td>
<select name="WebLangDefault" id="WebLangDefault">
<?php
for($i=1;$i<=$WebLangKind;$i++){
	if($i != $WebLangDefault){
		echo "<option value=\"{$i}\">第{$i}种语言({$WebLangName[$i-1]})</option>";
	} else {
		echo "<option value=\"{$i}\" selected=\"selected\">第{$i}种语言({$WebLangName[$i-1]})</option>";
	}
}
?>
</select>
		</td>
	 	<td>改变默认语言后请<a href="NavigationSet.php">更新导航栏</a>，否则可能访问不正常</td>
 	</tr>
	 <tr class="odd">
    <td align="right">是否开启中文简繁互换：</td>
    <td>
		<input type="radio" name="isTraditional" id="radio11" value="1" <?php if($isTraditional==1) {echo 'checked="checked"';} ?> />是
    	<input name="isTraditional" type="radio" id="radio12" value="0" <?php if($isTraditional==0) {echo 'checked="checked"';} ?> />否
	</td>
    <td>&nbsp;</td>
  	</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#CCCCCC" class="sub">
   <tr class="odd">
     <td width="16%" height="35" align="right">&nbsp;</td>
     <td><input type="submit" name="Submit" id="button" value="提 交" class="submit" />
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="reset" name="button2" id="button2" value="重 置" class="submit" />
      <input name="Action" type="hidden" id="Action" value="UpDate" /></td>
     <td align="right" style="color:#666666;">
     最后一次修改时间：<font class="Igreen"><?php echo $WebDate?></font>&nbsp;|
     修改者：<font class="Igreen"><?php echo $WebAdminName?></font>&nbsp;|
     修改者IP：<a target="_blank" href="../inc/gettopost.php?Action=IP&IP=<?php echo $WebIP?>"><?php echo $WebIP?></a></td>
   </tr>
</table>
</form>
<?php if($ConfigEmailServer == 1){ ?>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="6">
	<tr class="Notodd">
		<td style="color:#333333; line-height:20px;">
注：1、强制编译仅在修改、制作模板调试时开启，正式运行强烈建议关闭该功能；<br />
　　2、当开启了每次都强制生成新的 Smarty 编译文件时，模板缓存将不起作用；<br />
　　3、模板缓存有效时间段的长度(单位秒),一旦这个时间失效,将会生成新的缓存文件。值为-1时,将强迫缓存永不过期，0值将导致缓存总是重新生成(仅有利于测试)；<br />
　　4、自动生成静态：开通后程序将全自动生成静态页。当访问页面没有静态页时程序将在第一次访问时自动生成，当已经有生成的静态页时程序自动使用静态页。<br />
</td>
	</tr>
</table>
<?php } ?>
</body>
</html>